package cn.codehaus.core.system.server.impl;


import java.util.List;

import org.apache.commons.lang.xwork.StringUtils;

import cn.codehaus.core.common.exception.AppException;
import cn.codehaus.core.common.exception.NullAbleException;
import cn.codehaus.core.common.server.ApplicationContextUtil;
import cn.codehaus.core.system.dao.user.SysUsers;
import cn.codehaus.core.system.dao.user.UserDao;
import cn.codehaus.core.system.server.UserManage;

public class UserManageImpl implements UserManage
{
	private UserDao userDao = (UserDao) ApplicationContextUtil.getBean("UserDao");
	

	/**
	 * 验证用户登录
	 */
	@Override
	public boolean checkingLoginUser(SysUsers user) 
	{
		if(user == null)
		{
			throw new NullAbleException(user.getClass());
		}
		
		List<SysUsers> userList = userDao.findByAccounts(user.getAccounts());
		if(!userList.isEmpty())
		{
			if(userList.get(0).getPassword().equals(user.getPassword()))
			{
				return true;
			}
		}
		return false;
	}

}
